﻿-- Sample Data for web Installer. Also used for test cases

-- Delete all existing data
delete from comment
go
delete from post
go
delete from postcategory
go
delete from posttag
go
delete from tag
go
delete from blog
go
delete from users

-- Reseed necessary tables. All except tables that are many to many

DBCC CHECKIDENT (comment, reseed, 1)
go
DBCC CHECKIDENT (post, reseed, 1)
go
DBCC CHECKIDENT (postcategory, reseed, 1)
go
DBCC CHECKIDENT (tag, reseed, 1)
go
DBCC CHECKIDENT (blog, reseed, 1)
go

-- Insert Test Data for TDD VS.NET 2008 Test Project "TestsWithDB"

-- Blog 1 Test Data -- Blog Table
-- 1 Blog, 3 Post Categories, 2 Posts(assigned to First Category of first Blog), 1 Comment for each Post
INSERT INTO [Blog]
           ([Title]
           ,[SubTitle], ShortName,Active)
     VALUES
           ('Stamp Blog',
           'A Stamp Blog', 'stampblog',1)
GO

-- Blog 1 Test Data -- Post Category Table

INSERT INTO [PostCategory]
           ([BlogID]
           ,[Name])
     VALUES
           (1,
           'Test Category 1')
GO
INSERT INTO [PostCategory]
           ([BlogID]
           ,[Name])
     VALUES
           (1,
           'Test Category 2')
GO
INSERT INTO [PostCategory]
           ([BlogID]
           ,[Name])
     VALUES
           (1,
           'Test Category 3')

GO

-- Blog 1 Test Data Post Table

INSERT INTO [Post]
           ([Timestamp]
           ,[Title]
           ,[Body]
           ,[BlogId]
           ,[AllowComments]
           ,[Summary]
           ,[PostCategoryID])
     VALUES
           (GETDATE()
           ,'Test Post'
           ,'Test Body'
           ,1
           ,1
           ,'Test Summary'
           ,1)
GO
INSERT INTO [Post]
           ([Timestamp]
           ,[Title]
           ,[Body]
           ,[BlogId]
           ,[AllowComments]
           ,[Summary]
           ,[PostCategoryID])
     VALUES
           (GETDATE()
           ,'Test Post 2'
           ,'Test Body 2'
           ,1
           ,1
           ,'Test Summary 2'
           ,1)
GO

-- Test Blog 1 -- Comment Table

INSERT INTO [Comment]
           ([Timestamp]
           ,[Title]
           ,[Body]
           ,[Rating]
           ,[PostID]
           ,[Author]
           ,[Email])
     VALUES
           (GETDATE()
           ,'not implemented'
           ,'first! to comment'
           ,1
           ,1
           ,'John Haigh'
           ,'haighis@gmail.com')
GO
INSERT INTO [Comment]
           ([Timestamp]
           ,[Title]
           ,[Body]
           ,[Rating]
           ,[PostID]
           ,[Author]
           ,[Email])
     VALUES
           (GETDATE()
           ,'not implemented'
           ,'second! to comment'
           ,1
           ,2
           ,'John Haigh'
           ,'haighis@gmail.com')
GO


--------------------------------------------------------------
/**
-- Blog 2 Test Data -- Blog Table
-- 1 Blog, 3 Post Categories, 2 Posts(assigned to First Category for Second Blog), 1 Comment for each Post
INSERT INTO [Blog]
           ([Title]
           ,[SubTitle], ShortName,Active)
     VALUES
           ('Social Capital Blog',
           'A Social Capital Blog','socialcapital',1)
GO

-- Blog 2 Test Data -- Post Category Table

INSERT INTO [PostCategory]
           ([BlogID]
           ,[Name])
     VALUES
           (2,
           'Test Category 1')
GO
INSERT INTO [PostCategory]
           ([BlogID]
           ,[Name])
     VALUES
           (2,
           'Test Category 2')
GO
INSERT INTO [PostCategory]
           ([BlogID]
           ,[Name])
     VALUES
           (2,
           'Test Category 3')

GO

-- Blog 2 Test Data Post Table

INSERT INTO [Post]
           ([Timestamp]
           ,[Title]
           ,[Body]
           ,[BlogId]
           ,[AllowComments]
           ,[Summary]
           ,[PostCategoryID])
     VALUES
           (GETDATE()
           ,'Test Post'
           ,'Test Body'
           ,2
           ,1
           ,'Test Summary'
           ,4)
GO
INSERT INTO [Post]
           ([Timestamp]
           ,[Title]
           ,[Body]
           ,[BlogId]
           ,[AllowComments]
           ,[Summary]
           ,[PostCategoryID])
     VALUES
           (GETDATE()
           ,'Test Post 2'
           ,'Test Body 2'
           ,2
           ,1
           ,'Test Summary 2'
           ,4)
GO

-- Test Blog 1 -- Comment Table

INSERT INTO [Comment]
           ([Timestamp]
           ,[Title]
           ,[Body]
           ,[Rating]
           ,[PostID]
           ,[Author]
           ,[Email])
     VALUES
           (GETDATE()
           ,'not implemented'
           ,'first! to comment'
           ,1
           ,3
           ,'John Haigh'
           ,'haighis@gmail.com')
GO
INSERT INTO [Comment]
           ([Timestamp]
           ,[Title]
           ,[Body]
           ,[Rating]
           ,[PostID]
           ,[Author]
           ,[Email])
     VALUES
           (GETDATE()
           ,'not implemented'
           ,'second! to comment'
           ,1
           ,4
           ,'John Haigh'
           ,'haighis@gmail.com')
GO

**/